home *** CD-ROM | disk | FTP | other *** search
- Path: news.ov.com!news
- From: glenn@ov.com (Fletcher.Glenn@ov.com)
- Newsgroups: comp.lang.c
- Subject: Re: Please help me
- Date: 27 Mar 1996 22:41:02 GMT
- Organization: OpenVision
- Message-ID: <4jcg5u$noj@spanky.pls.ov.com>
- References: <4j6oke$lfk@badger.wmin.ac.uk>
- Reply-To: glenn@ov.com
- NNTP-Posting-Host: foghorn.pls.ov.com
-
- In article lfk@badger.wmin.ac.uk, darec@westminster.ac.uk (Nadarajah Thavaneethan) writes:
- >#include <std.h>
- >
- >void writelines( char[], int );
- > int index;
- >
- >
- >void main(void)
- >{
- >
- >int i;
- >char rest[80];
- >
- >
- > printf("Enter line ");
- > scanf("%s", rest);
- > printf("Enter size of new lines");
- > scanf("%d", i);
- > index =0;
- > writelines(rest, i);
- >}
- >
- >void writelines( char r[], int len)
- >{
- >int i;
- >
- > while (index < 80) {
- > for (i=0; i<len; i++)
- > {
- >
- > putchar(r[index]);
- > putchar('\n');
- > }
- > index++;
- >}
- >}
-
- Reformatting the above routine:
-
- void writelines( char r[], int len)
- {
- int i;
-
- while (index < 80)
- {
- for (i = 0; i < len; i++)
- {
- putchar(r[index]);
- putchar('\n');
- }
- index++;
- }
- }
-
- The above routine says: Step forward through the input string and
- for "len" times repeat each character followed by a newline.
- Is this what you intended? Isn't it easier to see when properly formatted?
-
- Fletcher.Glenn@ov.com
-
- >
- >This program reads a line of data and writes it out as smaller lines
- >it doesn't but it should!
- >
- >please mail me
- >
- >darec@westminster.ac.uk
- >
- >
- >Thanks in Advance..
- >
- >
-
-
-
-
-
-